<template>
  <div class="content">
    <div style="margin-top: 5rem;">
      <h3>{{ $route.meta.title }}（奖励USDT）</h3>
      <el-divider />

    </div>
    <div>
      <div class="box">
        <div class="boxtitle">
          一代收益
        </div>
        <div class="boxcontent">
          <div class="int"> <el-input v-model="params.oneYield" type="text"> %</el-input></div> %
        </div>
        <div class="boxtitle">
          二代收益
        </div>
        <div class="boxcontent">
          <div class="int"> <el-input v-model="params.twoYield" type="text"> %</el-input></div> %
        </div>

        <div class="boxcontent">
          <div class="int" style="text-align: right;width:80%;"> <el-button type="primary" @click="determine">确定保存</el-button></div>
        </div>

      </div>

    </div>
  </div>
  </div>
</template>
<script>
import { getReferrerYieldConf, referrerYieldConf } from '@/api/jackbo/platform.js'
export default {
  name: 'Share',
  data() {
    return {
      params: {
        oneYield: '',
        twoYield: ''

      }

    }
  },
  mounted() {
    this.getlist()
  },
  methods: {
    async getlist() {
      const res = await getReferrerYieldConf()
      if (res.code == 0) {
        for (const key in res.data) {
          res.data[key] = parseInt(res.data[key])
        }
        console.log(res.data)
        this.params = res.data
      }
    },
    async determine() {
      const params = {
        ...this.params
      }
      const res = await referrerYieldConf(params)
      if (res.code == 0) {
        this.getlist()
      }

      // console.log(obj)
    }
  }
}
</script>
<style scoped>
  .box{
    /* height:8rem; */
    padding: 1rem;
    width: 98%;
    margin: 0 auto;
    border: 1px solid #dddddd;
    border-radius: 0.5rem;
      /* border; */
      margin-top: 2rem;
  }
  .boxtitle{
    font-size:1.25rem;
    height: 3rem;
    line-height: 3rem;
  }
  .int{
    display: inline-block;
    width: 50%;

  }
  .boxcontent{
    font-size:1.25rem;
    height: 3rem;
    line-height: 3rem;
  }
</style>
